import java.util.Arrays;

public class J2102 {
    public static int[] find(int[] arr, int target){
        int i, j, m = -1;
        //可鞥有多种情况，需要将数组设置大一点
        int[] twoNum = new int[10];
        int k = arr.length;
        //当元素来到最后一个时已经无法满足条件
        for(i = 0; i < k; i++){
            //每一个元素与后面的元素相加，避免重复计算
            j = i + 1;
            for(j = i + 1; j < k ; j++){
                if(arr[i] + arr[j] == target){
                    twoNum[++m] = i;
                    twoNum[++m] = j;
                    break;
                }
            }
        }
        return twoNum;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1,2,3,4,5,6,7,8,9,10};
        int[] targetNum = find(nums, 15);
        String ret = Arrays.toString(targetNum);
        System.out.println(ret);
    }
}
